import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import qiankun from 'vite-plugin-qiankun'
import { outDir } from './src/config'
export default defineConfig({
  base: './',
  plugins: [
    vue(),
    qiankun('vue-app', {
      useDevMode: true,
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  build: {
    target: 'esnext',
    cssTarget: 'chrome80',
    // 指定打包文件的输出路径
    outDir: outDir,
  },
  server: {
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    cors: true,
  },
  // 添加这个配置来解决模块导入问题
  optimizeDeps: {
    // include: ['vue'],
  },
})
